Ext.define('HIT.view.SetImportFileTitlePanel', {
    extend: 'Ext.form.Panel',
    alias:'widget.setimportfilegrid',

    height: 350,
    width: 510,
    layout: {
        type: 'absolute'
    },
    bodyPadding: 10,

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [
                {
                	xtype:'hidden',
                	id:'share-new-address',
                	value:'000'
                },
                {
                    xtype: 'fieldset',
                    x: 20,
                    y: 10,
                    height: 310,
                    id: 'set-import-file-fieldset',
                    width: 470,
                    layout: {
                        type: 'absolute'
                    },
                    title: Share.T('本地导入文件标题'),
                    items: [
                        {
                            xtype: 'textfield',
                            x: 20,
                            y: 10,
                            width: 233,
                            id: 'set-import-file-title-1',
                            maxLength :50,
                            msgTarget  : 'side',
                            fieldLabel: Share.T('标题一'),
                            emptyText: Share.T('请输入文件标题')
                        },
                        {
                            xtype: 'textfield',
                            x: 20,
                            y: 160,
                            width: 233,
                            id: 'set-import-file-title-4',
                            maxLength :50,
                            msgTarget  : 'side',
                            fieldLabel: Share.T('标题四'),
                            emptyText: Share.T('请输入文件标题')
                        },
                        {
                            xtype: 'textfield',
                            x: 20,
                            y: 110,
                            width: 233,
                            id: 'set-import-file-title-3',
                            maxLength :50,
                            msgTarget  : 'side',
                            fieldLabel: Share.T('标题三'),
                            emptyText: Share.T('请输入文件标题')
                        },
                        {
                            xtype: 'textfield',
                            x: 20,
                            y: 60,
                            width: 233,
                            id: 'set-import-file-title-2',
                            maxLength :50,
                            msgTarget  : 'side',
                            fieldLabel: Share.T('标题二'),
                            emptyText: Share.T('请输入文件标题')
                        },
                        {
                            xtype: 'textfield',
                            x: 20,
                            y: 210,
                            width: 233,
                            id: 'set-import-file-title-5',
                            maxLength :50,
                            msgTarget  : 'side',
                            fieldLabel: Share.T('标题五'),
                            emptyText: Share.T('请输入文件标题')
                        },
                        {
                            xtype: 'checkboxfield',
                            x: 290,
                            y: 60,
                            id: 'set-import-file-check-2',
                            fieldLabel: Share.T('是否启用'),
                            listeners:{
                            	change: function(Box,NewValue,OldValue,eOpts){
                            			Ext.getCmp('set-import-file-title-2').setDisabled(!NewValue);
                            			if(!NewValue){Ext.getCmp('set-import-file-title-2').setValue("");};
                            	}
                            }
                        },
                        {
                            xtype: 'checkboxfield',
                            x: 290,
                            y: 160,
                            id: 'set-import-file-check-4',
                            fieldLabel: Share.T('是否启用'),
                            listeners:{
                            	change: function(Box,NewValue,OldValue,eOpts){
                            			Ext.getCmp('set-import-file-title-4').setDisabled(!NewValue);
                            			if(!NewValue){Ext.getCmp('set-import-file-title-4').setValue("");};
                            	}
                            }
                        },
                        {
                            xtype: 'checkboxfield',
                            x: 290,
                            y: 110,
                            id: 'set-import-file-check-3',
                            fieldLabel: Share.T('是否启用'),
                            listeners:{
                            	change: function(Box,NewValue,OldValue,eOpts){
                            			Ext.getCmp('set-import-file-title-3').setDisabled(!NewValue);
                            			if(!NewValue){Ext.getCmp('set-import-file-title-3').setValue("");};
                            	}
                            }
                        },
                        {
                            xtype: 'checkboxfield',
                            x: 290,
                            y: 210,
                            id: 'set-import-file-check-5',
                            fieldLabel: Share.T('是否启用'),
                            listeners:{
                            	change: function(Box,NewValue,OldValue,eOpts){
                            			Ext.getCmp('set-import-file-title-5').setDisabled(!NewValue);
                            			if(!NewValue){Ext.getCmp('set-import-file-title-5').setValue("");};
                            	}
                            }
                        },
                        {
                            xtype: 'checkboxfield',
                            x: 290,
                            y: 10,
                            id: 'set-import-file-check-1',
                            fieldLabel: Share.T('是否启用'),
                            listeners:{
                            	change: function(Box,NewValue,OldValue,eOpts){
                            			Ext.getCmp('set-import-file-title-1').setDisabled(!NewValue);
                            			if(!NewValue){Ext.getCmp('set-import-file-title-1').setValue("");};
                            	}
                            }
                        }
                    ]
                }
            ],listeners: {
            	beforerender: function(FieldSet,eOpts){
            		Share.AjaxRequest({
            			url: ctx+ '/getLocalFileTitle',  //FileUploadController.java
            			showMsg: false,
                        params   : {
                        },
                        callback : function(json) {
                        	if(json[0] == null){
                        		for(var i=1;i<6;i++){
                        			Ext.getCmp('set-import-file-title-'+i).setDisabled(true);
                        			Ext.getCmp('set-import-file-check-'+i).setValue(false);
                        		}
                        	}else{
                        		Ext.getCmp('set-import-file-title-1').setDisabled(!json[0].TITLE1);
                        		Ext.getCmp('set-import-file-check-1').setValue(json[0].TITLE1 == '' ? false : json[0].TITLE1 == null ? false : true);
                        		Ext.getCmp('set-import-file-title-1').setValue(json[0].TITLE1);
                        		//---
                        		Ext.getCmp('set-import-file-title-2').setDisabled(!json[0].TITLE2);
                        		Ext.getCmp('set-import-file-check-2').setValue(json[0].TITLE2 == '' ? false : json[0].TITLE2 == null ? false : true);
                        		Ext.getCmp('set-import-file-title-2').setValue(json[0].TITLE2);
                        		//---
                        		Ext.getCmp('set-import-file-title-3').setDisabled(!json[0].TITLE3);
                        		Ext.getCmp('set-import-file-check-3').setValue(json[0].TITLE3 == '' ? false : json[0].TITLE3 == null ? false : true);
                        		Ext.getCmp('set-import-file-title-3').setValue(json[0].TITLE3);
                        		//---
                        		Ext.getCmp('set-import-file-title-4').setDisabled(!json[0].TITLE4);
                        		Ext.getCmp('set-import-file-check-4').setValue(json[0].TITLE4 == '' ? false : json[0].TITLE4 == null ? false : true);
                        		Ext.getCmp('set-import-file-title-4').setValue(json[0].TITLE4);
                        		//---
                        		Ext.getCmp('set-import-file-title-5').setDisabled(!json[0].TITLE5);
                        		Ext.getCmp('set-import-file-check-5').setValue(json[0].TITLE5 == '' ? false : json[0].TITLE5 == null ? false : true);
                        		Ext.getCmp('set-import-file-title-5').setValue(json[0].TITLE5);
                        	}
                        }
            		});
            	}
            }
        });

        me.callParent(arguments);
    }

});